<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/17 0017
 * Time: 9:44
 */

// 读取外部扩展配置文件
$env = empty(ENV) ? 'local' : ENV;
$config_lists_path =  EXTEND_PATH . 'config/'.$env;
if (is_dir($config_lists_path)) {
	$lists   = $config_lists_path;
	$config_list = scandir($lists);
	foreach ($config_list as $file) {
		if (strpos($file, CONF_EXT)) {
			$filenames = $lists . DS . $file;
			\think\Config::load( $filenames , pathinfo($file, PATHINFO_FILENAME) ) ;
		}
	}
}

//静态资源目录配置路径
$static_path = \think\Config::has('gobal.staticServer') ? \think\Config::get('gobal.staticServer') : '';
\think\Config::set([
	'style'     => $static_path.'/template/default',
	'resources' => $static_path.'/template/default/m_luckdraw',
	'singleDraw'  => $static_path.'/template/default/m_luckdraw/singleDraw',
]);

//数据库环境设置
$hostname = ENV <> 'local' ? 'rm-2ze31811ft7qc3x2s.mysql.rds.aliyuncs.com' : 'rm-2ze31811ft7qc3x2so.mysql.rds.aliyuncs.com';
\think\Config::set('database.hostname',$hostname);
